Format Properties are available for Text Boxes and Dropdowns. It enables default and custom format rendering and validation. It is extremely useful to ensure that numbers, dates, times, and various other formats are entered correctly 100% of the time. There are a variety of Format categories, which are described below.
This is the default setting; no format is specified.
A Number format allows Revu to quickly parse input text and formats the output text in a specific manner. When selected, the following options become available:
Use the date format to enter, parse, and validate dates. When selected, the following options become available:
Built-in Date Options: There are 25 built-in date options. The following table describes the formatting options for the date:
Format Token |
Semantics |
m |
The month number from 1 to 9 |
mm |
The month number from 01 to 12 |
mmm |
The abbreviated month (i.e. Jan) |
mmmm |
The full month (i.e. January) |
d |
The day number from 1 to 9 |
dd |
The day number from 1 to 31 |
ddd |
The abbreviated day of the week (i.e. Fri) |
dddd |
The full day of the week (i.e. Friday) |
yy |
The year (00 is short for 2000) |
yyyy |
The full year |
HH |
Hours in 24-hour format |
hh |
Hours in 12-hour format |
MM |
Minutes |
ss |
Seconds |
tt |
AM or PM |
Custom Date Option: If an alternative format is required, a custom date option may be defined. A custom formatting string may be defined using the above table to format the date appearance. For example, ss:MM:HH:dd:mm:yyyy would format the entry 00:31:15:11:02:2011 to be shown as 2/11/2011 3:31 PM.
There are a few special format types. The format types are described in further detail.
\d{0,3}(\.|[- ])?\d{0,3}(\.|[- ])?\d{0,4}
\(\d{0,3}
\(\d{0,3}\)(\.|[- ])?\d{0,3}(\.|[- ])?\d{0,4}
\(\d{0,3}(\.|[- ])?\d{0,3}(\.|[- ])?\d{0,4}
\d{0,3}\)(\.|[- ])?\d{0,3}(\.|[- ])?\d{0,4}
011(\.|[- \d])*
Phone numbers such as 888-888-8888 or (888) 888-8888 would be identified as a valid phone numbers.
The custom format category is used if none of the built-in formats meet the requirements. Examples applications for a custom field would be for email addresses or Bates Numbers.
// add this to the Global JavaScripts
String.prototype.isNumber = function() {
var data = this.valueOf();
if (data.match(/^[0-9]+$/)) {
returntrue;
}
returnfalse;
};
OnCustomFormatEvent = function(event) {
var field = this.getField("Text1");
var data = new String(field.value);
if (data.isNumber()) {
event.value = "Number Identified";
}
else {
event.value = "Number Not Identified";
}
};
// add this to the Custom Format Script for your Text Box named Text1
OnCustomFormatEvent(event);
Upon invoking custom format script, the event.value is read back from the event object.Other properties, for example event.rc, are ignored.
var data = new Number(event.value);
if (1 <= data && data <= 100) {
event.rc = false;
}
else {
event.rc = true;
}